home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / MELL / NETLIB00 / NetLib / c / network < prev    next >
Text File  |  1995-02-28  |  304b  |  17 lines

  1. #include "arpa/inet.h"
  2. #include "netinet/in.h"
  3. #include "sys/byteorder.h"
  4.  
  5. /*
  6.  * Extract a network number in host byte order from a string
  7.  */
  8. u_long inet_network(const char *cp)
  9. {
  10.   struct in_addr net;
  11.  
  12.   /* Decode the address string */
  13.   net.s_addr = inet_addr(cp);
  14.  
  15.   return ntohl(inet_netof(net));
  16. }
  17.